//
//  notMac.h
//  notMac
//
//  Created by Iain Wade on 7/01/07.
//  Copyright 2007 __MyCompanyName__. All rights reserved.
//

#import <Cocoa/Cocoa.h>
#import <XMLRPC/XMLRPC.h>
#import <Keychain/Keychain.h>

@interface NSUserDefaults (ApplePrivate)
- (id) objectForKey:(NSString*)key inDomain:(NSString*)domain;
- (void) removeObjectForKey:(NSString*)key inDomain:(NSString*)domain;
- (void) setObject:(id)object forKey:(NSString*)key inDomain:(NSString*)domain;
@end

@interface notMac : NSObject {
    NSString *username;
    NSString *password;
    NSString *serviceURL;
    NSString *sid;
    NSString *run;
}

+ (void)clearEnvironment;

+ (id)notMacFromEnvironment;
+ (id)notMacWithUsername:(NSString *)user password:(NSString *)pass serviceURL:(NSString *)URL;
- (id)initWithUsername:(NSString *)user password:(NSString *)pass serviceURL:(NSString *)URL;
- (void)saveToEnvironment;

- (NSString *)username;
- (NSString *)password;
- (NSString *)serviceURL;

- (BOOL)validate;

- (NSDictionary *)storageInfo;

- (NSString *)openSession:(NSString *)clientIdentifier;
- (NSDictionary *)getRecordsOfType:(NSString *)entityName sinceRun:(NSString *)sinceRun;
- (BOOL)deleteAllRecordsOfType:(NSString *)entityName;
- (BOOL)deleteRecordWithIdentifier:(NSString *)identifier ofType:(NSString *)entityName;
- (BOOL)replaceRecord:(NSData *)record withIdentifier:(NSString *)identifier ofType:(NSString *)entityName;
- (BOOL)finishSession;

- (void)dealloc;

@end
